load("//bazel:mongo_src_rules.bzl", "idl_generator", "mongo_cc_library", "mongo_cc_unit_test")

package(default_visibility = ["//visibility:public"])

exports_files(
    glob([
        "*.h",
        "*.cpp",
    ]),
)

# Shared mongod/mongos query code.
mongo_cc_library(
    name = "query_common",
    srcs = [
        "explain_common.cpp",
        "find_common.cpp",
    ],
    hdrs = [
        "explain_common.h",
        "find.h",
        "find_common.h",
    ],
    deps = [
        ":common_query_enums_and_helpers",
        ":query_planner",
        ":query_request",
        "//src/mongo/db:curop_failpoint_helpers",
        "//src/mongo/db:server_base",
        "//src/mongo/db/query/collation:collator_factory_icu",
        "//src/mongo/db/query/collation:collator_icu",
        "//src/mongo/db/query/datetime:init_timezone_data",
        "//src/mongo/util:fail_point",
    ],
)

mongo_cc_library(
    name = "canonical_distinct",
    srcs = [
        "canonical_distinct.cpp",
        "//src/mongo/db/pipeline:document_source_replace_root.h",
    ],
    hdrs = [
        "canonical_distinct.h",
    ],
    deps = [
        "//src/mongo/db:commands",
        "//src/mongo/db:query_expressions",
        "//src/mongo/db:server_base",
    ],
)

mongo_cc_library(
    name = "random_utils",
    srcs = [
        "random_utils.cpp",
    ],
    hdrs = [
        "random_utils.h",
    ],
    deps = [
        "//src/mongo:base",
    ],
)

mongo_cc_library(
    name = "substr_utils",
    srcs = [
        "substr_utils.cpp",
    ],
    hdrs = [
        "substr_utils.h",
    ],
    deps = [
        "//src/mongo:base",
    ],
)

mongo_cc_library(
    name = "query_index_bounds",
    srcs = [
        "index_bounds.cpp",
        "index_entry.cpp",
        "index_tag.cpp",
        "interval.cpp",
    ],
    hdrs = [
        "index_bounds.h",
        "index_entry.h",
        "index_tag.h",
        "interval.h",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db:query_expressions",
    ],
)

mongo_cc_library(
    name = "canonical_query",
    srcs = [
        "canonical_query.cpp",
        "canonical_query_encoder.cpp",
        "parsed_distinct_command.cpp",
        "parsed_find_command.cpp",
        "query_utils.cpp",
        "//src/mongo/db/query/query_shape:count_cmd_shape.cpp",
        "//src/mongo/db/query/query_shape:distinct_cmd_shape.cpp",
        "//src/mongo/db/query/query_shape:find_cmd_shape.cpp",
        "//src/mongo/db/query/query_stats:find_key.cpp",
    ],
    hdrs = [
        "canonical_query.h",
        "canonical_query_encoder.h",
        "indexability.h",
        "parsed_distinct_command.h",
        "parsed_find_command.h",
        "query_utils.h",
        "//src/mongo/db/exec/sbe:match_path.h",
        "//src/mongo/db/query/query_shape:count_cmd_shape.h",
        "//src/mongo/db/query/query_shape:distinct_cmd_shape.h",
        "//src/mongo/db/query/query_shape:find_cmd_shape.h",
        "//src/mongo/db/query/query_stats:find_key.h",
    ],
    deps = [
        ":canonical_distinct",
        ":common_query_enums_and_helpers",
        ":projection_ast",
        ":sort_pattern",
        "//src/mongo/crypto:encrypted_field_config",
        "//src/mongo/db:query_expressions",
        "//src/mongo/db/pipeline",
        "//src/mongo/db/query/collation:collator_factory_interface",
        "//src/mongo/db/query/collation:collator_interface",
    ],
)

mongo_cc_library(
    name = "memory_util",
    srcs = [
        "//src/mongo/db/query/util:memory_util.cpp",
    ],
    hdrs = [
        "//src/mongo/db/query/util:memory_util.h",
    ],
    deps = [
        "//src/mongo/util:pcre_wrapper",  # TODO(SERVER-93876): Remove.
        "//src/mongo/util:processinfo",
    ],
)

idl_generator(
    name = "explain_verbosity_gen",
    src = "explain_verbosity.idl",
)

mongo_cc_library(
    name = "common_query_enums_and_helpers",
    srcs = [
        "allowed_contexts.cpp",
        "analyze_regex.cpp",
        "explain_options.cpp",
        ":explain_verbosity_gen",
    ],
    hdrs = [
        "allowed_contexts.h",
        "analyze_regex.h",
        "explain_options.h",
    ],
    deps = [
        "//src/mongo/db:api_parameters",
        "//src/mongo/db:server_base",
        "//src/mongo/db:service_context",
        "//src/mongo/transport:transport_layer_common",  # TODO(SERVER-93876): Remove.
    ],
)

idl_generator(
    name = "hint_gen",
    src = "hint.idl",
)

idl_generator(
    name = "find_command_gen",
    src = "find_command.idl",
    deps = [
        ":hint_gen",
        "//src/mongo/crypto:fle_field_schema_gen",
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/auth:access_checks_gen",
        "//src/mongo/db/auth:action_type_gen",
        "//src/mongo/db/pipeline:legacy_runtime_constants_gen",
        "//src/mongo/db/query/client_cursor:cursor_response_gen",
        "//src/mongo/db/query/query_settings:query_settings_gen",
        "//src/mongo/db/session:logical_session_id_gen",
        "//src/mongo/idl:generic_argument_gen",
    ],
)

idl_generator(
    name = "index_hint_gen",
    src = "index_hint.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "query_knobs_gen",
    src = "query_knobs.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/idl:cluster_server_parameter_gen",
    ],
)

mongo_cc_library(
    name = "projection_ast",
    srcs = [
        "projection.cpp",
        "projection_ast_util.cpp",
        "projection_parser.cpp",
        "//src/mongo/base:exact_cast.h",
        "//src/mongo/db/query:projection_ast_path_tracking_visitor.h",
    ],
    hdrs = [
        "projection.h",
        "projection_ast_util.h",
        "projection_parser.h",
    ],
    deps = [
        "//src/mongo/db:query_expressions",
        "//src/mongo/db:server_base",
    ],
)

mongo_cc_library(
    name = "sort_pattern",
    srcs = [
        "sort_pattern.cpp",
    ],
    hdrs = [
        "sort_pattern.h",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db:query_expressions",  # TODO(SERVER-93876): Remove.
        "//src/mongo/db/exec/document_value",
    ],
)

mongo_cc_library(
    name = "plan_yield_policy",
    srcs = [
        "plan_yield_policy.cpp",
    ],
    hdrs = [
        "plan_yield_policy.h",
    ],
    deps = [
        "//src/mongo:base",  # TODO(SERVER-93876): Remove.
        "//src/mongo/db:shard_role",
        "//src/mongo/db/catalog:collection_uuid_mismatch_info",
        "//src/mongo/db/concurrency:exception_util",
        "//src/mongo/db/storage:recovery_unit_base",  # TODO(SERVER-93876): Remove.
        "//src/mongo/util:elapsed_tracker",
        "//src/mongo/util:fail_point",  # TODO(SERVER-93876): Remove.
    ],
)

mongo_cc_library(
    name = "plan_executor",
    srcs = [
        "plan_executor.cpp",
        "plan_yield_policy_remote_cursor.cpp",
        "yield_policy_callbacks_impl.cpp",
    ],
    hdrs = [
        "plan_executor.h",
        "plan_yield_policy_remote_cursor.h",
        "yield_policy_callbacks_impl.h",
    ],
    deps = [
        ":plan_yield_policy",
        ":query_common",
        "//src/mongo/db:server_base",
        "//src/mongo/db:shard_filterer",
        "//src/mongo/db:shard_role",
        "//src/mongo/db/catalog:collection_query_info",
        "//src/mongo/db/catalog:database_holder",
        "//src/mongo/db/collection_crud",
        "//src/mongo/executor:task_executor_cursor",
    ],
)

idl_generator(
    name = "tailable_mode_gen",
    src = "tailable_mode.idl",
)

idl_generator(
    name = "query_feature_flags_gen",
    src = "query_feature_flags.idl",
)

mongo_cc_library(
    name = "spill_util",
    srcs = [
        "//src/mongo/db/query/util:spill_util.cpp",
    ],
    hdrs = [
        "//src/mongo/db/query/util:spill_util.h",
    ],
    deps = [
        ":query_knobs",
        "//src/mongo/db/storage:disk_space_util",
    ],
)

mongo_cc_library(
    name = "query_knobs",
    srcs = [
        "explain_version_validator.cpp",
        "framework_control.cpp",
        "plan_ranker_mode.cpp",
        "query_feature_flags_gen",
        "query_knobs_gen",
        "sampling_confidence_interval.cpp",
        "//src/mongo/db/query/plan_cache:sbe_plan_cache_on_parameter_change.cpp",
        "//src/mongo/db/query/query_stats:query_stats_on_parameter_change.cpp",
    ],
    hdrs = [
        "explain_version_validator.h",
        "//src/mongo/db/query/plan_cache:sbe_plan_cache_on_parameter_change.h",
        "//src/mongo/db/query/query_stats:query_stats_on_parameter_change.h",
    ],
    deps = [
        ":memory_util",
        "//src/mongo/db:server_base",
        "//src/mongo/db:service_context",
        "//src/mongo/db/commands:test_commands_enabled",  # TODO(SERVER-93876): Remove.
        "//src/mongo/idl:cluster_server_parameter",
        "//src/mongo/util:pcre_wrapper",  # TODO(SERVER-93876): Remove.
    ],
)

mongo_cc_library(
    name = "query_knob_configuration",
    srcs = [
        "query_knob_configuration.cpp",
    ],
    hdrs = [
        "query_knob_configuration.h",
    ],
    deps = [
        ":query_knobs",
        "//src/mongo/db:mongohasher",  # TODO(SERVER-93876): Remove.
        "//src/mongo/db:server_base",  # TODO(SERVER-93876): Remove.
    ],
)

idl_generator(
    name = "distinct_command_gen",
    src = "distinct_command.idl",
    deps = [
        ":hint_gen",
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/query/query_settings:query_settings_gen",
        "//src/mongo/idl:generic_argument_gen",
    ],
)

idl_generator(
    name = "expression_geo_index_knobs_gen",
    src = "expression_geo_index_knobs.idl",
)

mongo_cc_library(
    name = "index_multikey_helpers",
    hdrs = [
        "index_multikey_helpers.h",
    ],
    deps = [
        "//src/mongo/db/index:index_access_method",
    ],
)

mongo_cc_library(
    name = "index_bounds_builder",
    srcs = [
        "expression_geo_index_mapping.cpp",
        "index_bounds_builder.cpp",
        "interval_evaluation_tree.cpp",
        ":expression_geo_index_knobs_gen",
    ],
    hdrs = [
        "expression_geo_index_mapping.h",
        "index_bounds_builder.h",
        "interval_evaluation_tree.h",
    ],
    deps = [
        ":canonical_query",
        ":index_multikey_helpers",
        ":query_index_bounds",
        "//src/mongo/db:server_base",
        "//src/mongo/db/geo:geometry",
        "//src/mongo/db/index:expression_params",
        "//src/third_party/s2",
    ],
)

mongo_cc_library(
    name = "index_bounds_builder_test_fixture",
    hdrs = [
        "index_bounds_builder_test_fixture.h",
    ],
)

mongo_cc_library(
    name = "query_planner",
    srcs = [
        "distinct_access.cpp",
        "planner_access.cpp",
        "planner_analysis.cpp",
        "planner_ixselect.cpp",
        "planner_wildcard_helpers.cpp",
        "query_planner.cpp",
        "query_planner_common.cpp",
        "query_settings.cpp",
        "query_solution.cpp",
        "record_id_range.cpp",
        "stage_types.cpp",
        "//src/mongo/db/query/plan_cache:plan_cache_indexability.cpp",
        "//src/mongo/db/query/plan_enumerator:enumerator_memo.cpp",
        "//src/mongo/db/query/plan_enumerator:memo_prune.cpp",
        "//src/mongo/db/query/plan_enumerator:plan_enumerator.cpp",
        "//src/mongo/db/query/util:set_util.h",
        "//src/mongo/util:map_utils.h",
    ],
    hdrs = [
        "distinct_access.h",
        "planner_access.h",
        "planner_analysis.h",
        "planner_ixselect.h",
        "planner_wildcard_helpers.h",
        "query_planner.h",
        "query_planner_common.h",
        "query_settings.h",
        "query_solution.h",
        "record_id_range.h",
        "stage_types.h",
        "//src/mongo/db/query/plan_cache:plan_cache_indexability.h",
        "//src/mongo/db/query/plan_enumerator:enumerator_memo.h",
        "//src/mongo/db/query/plan_enumerator:memo_prune.h",
        "//src/mongo/db/query/plan_enumerator:plan_enumerator.h",
    ],
    deps = [
        ":canonical_query",
        ":index_bounds_builder",
        ":index_multikey_helpers",
        ":query_index_bounds",
        ":query_knobs",
        "//src/mongo/db:query_expressions",
        "//src/mongo/db:record_id_helpers",
        "//src/mongo/db:server_base",
        "//src/mongo/db/catalog:collection_options",
        "//src/mongo/db/commands:server_status_core",
        "//src/mongo/db/exec/sbe:query_sbe_plan_stats",
        "//src/mongo/db/fts:base_fts",
        "//src/mongo/db/index:expression_params",
        "//src/mongo/db/index:index_access_method",
        "//src/mongo/db/query/cost_based_ranker:cardinality_estimator",
        "//src/mongo/db/query/cost_based_ranker:cost_estimator",
        "//src/mongo/db/query/plan_cache:query_plan_cache",
    ],
)

mongo_cc_library(
    name = "bucket_predicate_generator",
    srcs = [
        "//src/mongo/db/query/timeseries:bucket_level_comparison_predicate_generator.cpp",
        "//src/mongo/db/query/timeseries:bucket_level_id_predicate_generator.cpp",
        "//src/mongo/db/query/timeseries:bucket_spec.cpp",
    ],
    hdrs = [
        "//src/mongo/db/query/timeseries:bucket_level_comparison_predicate_generator.h",
        "//src/mongo/db/query/timeseries:bucket_level_id_predicate_generator.h",
        "//src/mongo/db/query/timeseries:bucket_spec.h",
    ],
    deps = [
        "//src/mongo/bson/column",
        "//src/mongo/db:query_expressions",
        "//src/mongo/db/exec/document_value",
        "//src/mongo/db/timeseries:timeseries_options",
    ],
)

idl_generator(
    name = "analyze_command_gen",
    src = "analyze_command.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/auth:access_checks_gen",
        "//src/mongo/db/auth:action_type_gen",
        "//src/mongo/idl:generic_argument_gen",
    ],
)

idl_generator(
    name = "count_command_gen",
    src = "count_command.idl",
    deps = [
        ":hint_gen",
        "//src/mongo/crypto:fle_field_schema_gen",
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/auth:access_checks_gen",
        "//src/mongo/db/auth:action_type_gen",
        "//src/mongo/idl:generic_argument_gen",
    ],
)

mongo_cc_library(
    name = "command_request_response",
    srcs = [
        "analyze_command_gen",
        "count_command_as_aggregation_command.cpp",
        "count_command_gen",
        "count_request.cpp",
        "view_response_formatter.cpp",
        "//src/mongo/db/query/client_cursor:clientcursor.h",
        "//src/mongo/db/query/client_cursor:cursor_id.h",
        "//src/mongo/db/query/client_cursor:cursor_request.cpp",
        "//src/mongo/db/query/client_cursor:cursor_response.cpp",
        "//src/mongo/db/query/client_cursor:kill_cursors_gen",
    ],
    hdrs = [
        "count_command_as_aggregation_command.h",
        "count_request.h",
        "view_response_formatter.h",
        "//src/mongo/db/query/client_cursor:cursor_request.h",
        "//src/mongo/db/query/client_cursor:cursor_response.h",
    ],
    deps = [
        ":query_request",  # TODO(SERVER-93876): Remove.
        "//src/mongo/bson/util:bson_extract",  # TODO(SERVER-93876): Remove.
        "//src/mongo/db:common",  # TODO(SERVER-93876): Remove.
        "//src/mongo/db:server_base",
        "//src/mongo/db/query:hint_parser",
        "//src/mongo/db/query/client_cursor:cursor_response_idl",
        "//src/mongo/db/query/write_ops:write_ops_parsers",
        "//src/mongo/db/repl:optime",  # TODO(SERVER-93876): Remove.
        "//src/mongo/rpc",
        "//src/mongo/rpc:command_status",  # TODO(SERVER-93876): Remove.
    ],
)

idl_generator(
    name = "getmore_command_gen",
    src = "getmore_command.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/query/client_cursor:cursor_response_gen",
        "//src/mongo/db/repl:replication_types_gen",
        "//src/mongo/idl:generic_argument_gen",
    ],
)

mongo_cc_library(
    name = "query_request",
    srcs = [
        "distinct_command_gen",
        "find_command_gen",
        "getmore_command_gen",
        "query_request_helper.cpp",
        "tailable_mode.cpp",
        "tailable_mode_gen",
    ],
    hdrs = [
        "query_request_helper.h",
        "tailable_mode.h",
    ],
    deps = [
        ":hint_parser",
        "//src/mongo/crypto:fle_fields",
        "//src/mongo/db:api_parameters",  # TODO(SERVER-93876): Remove.
        "//src/mongo/db:server_base",
        "//src/mongo/db/auth:authprivilege",
        "//src/mongo/db/auth:security_token_auth",  # TODO(SERVER-93876): Remove.
        "//src/mongo/db/commands:test_commands_enabled",
        "//src/mongo/db/pipeline:runtime_constants_idl",  # TODO(SERVER-93876): Remove.
        "//src/mongo/db/query/client_cursor:cursor_response_idl",
        "//src/mongo/db/query/query_settings",
        "//src/mongo/db/repl:read_concern_args",  # TODO(SERVER-93876): Remove.
        "//src/mongo/db/repl:repl_coordinator_interface",  # TODO(SERVER-93876): Remove.
        "//src/mongo/s:common_s",
    ],
)

mongo_cc_library(
    name = "hint_parser",
    srcs = [
        "hint_parser.cpp",
        ":hint_gen",
    ],
    hdrs = [
        "hint_parser.h",
        ":hint_gen",
    ],
    header_deps = [
        "//src/mongo/db/concurrency:flow_control_ticketholder",
    ],
    deps = [
        "//src/mongo:base",
    ],
)

mongo_cc_library(
    name = "str_trim_utils",
    srcs = [
        "str_trim_utils.cpp",
    ],
    hdrs = [
        "//src/mongo/db/query:str_trim_utils.h",
    ],
    deps = [
        "//src/mongo:base",
    ],
)

mongo_cc_library(
    name = "index_hint",
    srcs = [
        "index_hint.cpp",
        ":index_hint_gen",
    ],
    header_deps = [
        "//src/mongo/db/repl:oplog_buffer_batched_queue",
    ],
    deps = [
        "//src/mongo/db:server_base",
    ],
)

mongo_cc_library(
    name = "map_reduce_output_format",
    srcs = [
        "map_reduce_output_format.cpp",
    ],
    hdrs = [
        "map_reduce_output_format.h",
    ],
    deps = [
        "//src/mongo/db:server_base",
    ],
)

mongo_cc_unit_test(
    name = "command_diagnostic_printer_test",
    srcs = [
        "command_diagnostic_printer_test.cpp",
        "//src/mongo/db/query:command_diagnostic_printer.h",
    ],
    tags = ["mongo_unittest_second_group"],
    deps = [
        "//src/mongo/db:commands",
        "//src/mongo/db:service_context_test_fixture",
    ],
)

mongo_cc_library(
    name = "query_test_service_context",
    srcs = [
        "query_test_service_context.cpp",
    ],
    hdrs = [
        "query_test_service_context.h",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db:service_context_test_fixture",
        "//src/mongo/db/concurrency:lock_manager",
        "//src/mongo/db/query/collation:collator_factory_mock",
        "//src/mongo/s:grid",
    ],
)

mongo_cc_library(
    name = "query_planner_test_fixture",
    srcs = [
        "query_planner_test_fixture.cpp",
    ],
    hdrs = [
        "query_planner_test_fixture.h",
    ],
    deps = [
        ":query_planner_test_lib",
        "//src/mongo:base",
        "//src/mongo/unittest",
    ],
)

mongo_cc_library(
    name = "query_planner_test_lib",
    srcs = [
        "query_planner_test_lib.cpp",
    ],
    hdrs = [
        "query_planner_test_lib.h",
    ],
    deps = [
        ":query_planner",
        ":query_test_service_context",
        "//src/mongo:base",
        "//src/mongo/db/pipeline:expression_context_for_test",
        "//src/mongo/db/query/collation:collator_factory_mock",
    ],
)

mongo_cc_unit_test(
    name = "db_query_test",
    srcs = [
        "canonical_distinct_test.cpp",
        "canonical_query_encoder_test.cpp",
        "canonical_query_test.cpp",
        "canonical_query_test_util.cpp",
        "canonical_query_test_util.h",
        "collection_query_info_test.cpp",
        "count_command_test.cpp",
        "field_effects_test.cpp",
        "field_set_test.cpp",
        "find_common_test.cpp",
        "getmore_request_test.cpp",
        "hint_parser_test.cpp",
        "index_bounds_builder_collator_test.cpp",
        "index_bounds_builder_eq_null_test.cpp",
        "index_bounds_builder_interval_test.cpp",
        "index_bounds_builder_regex_test.cpp",
        "index_bounds_builder_test.cpp",
        "index_bounds_builder_type_test.cpp",
        "index_bounds_test.cpp",
        "index_entry_test.cpp",
        "index_hint_test.cpp",
        "interval_evaluation_tree_test.cpp",
        "interval_test.cpp",
        "lru_key_value_test.cpp",
        "map_reduce_output_format_test.cpp",
        "plan_ranker_index_prefix_test.cpp",
        "plan_ranker_test.cpp",
        "planner_access_test.cpp",
        "planner_analysis_test.cpp",
        "planner_ixselect_test.cpp",
        "planner_wildcard_helpers_test.cpp",
        "projection_ast_test.cpp",
        "projection_test.cpp",
        "query_planner_array_test.cpp",
        "query_planner_collation_test.cpp",
        "query_planner_distinct_test.cpp",
        "query_planner_geo_test.cpp",
        "query_planner_hashed_index_test.cpp",
        "query_planner_index_test.cpp",
        "query_planner_operator_test.cpp",
        "query_planner_options_test.cpp",
        "query_planner_params_test.cpp",
        "query_planner_partialidx_test.cpp",
        "query_planner_pipeline_pushdown_test.cpp",
        "query_planner_text_test.cpp",
        "query_planner_tree_test.cpp",
        "query_planner_wildcard_index_test.cpp",
        "query_request_test.cpp",
        "query_settings_test.cpp",
        "query_solution_test.cpp",
        "record_id_range_test.cpp",
        "shard_filterer_factory_mock.cpp",
        "shard_filterer_factory_mock.h",
        "sort_pattern_test.cpp",
        "view_response_formatter_test.cpp",
        "wildcard_test_utils.h",
        "//src/mongo/db/catalog:collection_mock.h",
        "//src/mongo/db/catalog:index_catalog_entry_mock.h",
        "//src/mongo/db/catalog:index_catalog_mock.h",
        "//src/mongo/db/exec:shard_filterer_mock.h",
        "//src/mongo/db/exec/sbe:expression_test_base.h",
        "//src/mongo/db/exec/sbe:sbe_unittest.h",
        "//src/mongo/db/query:index_bounds_builder_test_fixture.h",
        "//src/mongo/db/query/classic_runtime_planner_for_sbe:classic_runtime_planner_for_sbe_test.cpp",
        "//src/mongo/db/query/classic_runtime_planner_for_sbe:classic_runtime_planner_for_sbe_test_util.cpp",
        "//src/mongo/db/query/classic_runtime_planner_for_sbe:classic_runtime_planner_for_sbe_test_util.h",
        "//src/mongo/db/query/client_cursor:cursor_response_test.cpp",
        "//src/mongo/db/query/client_cursor:killcursors_request_test.cpp",
        "//src/mongo/db/query/plan_cache:plan_cache_indexability_test.cpp",
        "//src/mongo/db/query/plan_cache:plan_cache_key_info_test.cpp",
        "//src/mongo/db/query/plan_cache:plan_cache_test.cpp",
        "//src/mongo/db/query/query_settings:query_settings_hash_test.cpp",
        "//src/mongo/db/query/query_settings:query_settings_manager_test.cpp",
        "//src/mongo/db/query/query_settings:query_settings_utils_test.cpp",
        "//src/mongo/db/query/query_settings:query_settings_validation_test.cpp",
        "//src/mongo/db/query/query_shape:agg_cmd_shape_test.cpp",
        "//src/mongo/db/query/query_shape:cmd_with_let_shape_test.cpp",
        "//src/mongo/db/query/query_shape:count_cmd_shape_test.cpp",
        "//src/mongo/db/query/query_shape:distinct_cmd_shape_test.cpp",
        "//src/mongo/db/query/query_shape:find_cmd_shape_test.cpp",
        "//src/mongo/db/query/stage_builder:classic_stage_builder_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:and_hash_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:and_sorted_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:expression_const_eval_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:gen_accumulator_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:gen_expression_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:gen_lookup_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:gen_window_function_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:sbe_builder_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:sbe_builder_test_fixture.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:sbe_builder_test_fixture.h",
        "//src/mongo/db/query/stage_builder/sbe/tests:shard_filter_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:type_checker_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:value_lifetime_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:vectorizer_test.cpp",
        "//src/mongo/db/query/util:cartesian_product.h",
        "//src/mongo/db/query/util:cartesian_product_test.cpp",
        "//src/mongo/db/query/util:deferred_test.cpp",
        "//src/mongo/db/query/util:hash_roaring_set_test.cpp",
        "//src/mongo/db/query/util:jparse_util_test.cpp",
        "//src/mongo/db/query/util:memory_util_test.cpp",
    ],
    tags = [
        "compile_requires_large_memory_gcc",
        "mongo_unittest_second_group",
    ],
    deps = [
        "common_query_enums_and_helpers",
        "hint_parser",
        "index_hint",
        "map_reduce_output_format",
        "query_common",
        "query_planner",
        "query_planner_test_fixture",
        "query_request",
        "query_test_service_context",
        "//src/mongo/db:multitenancy",
        "//src/mongo/db:query_exec",
        "//src/mongo/db:record_id_helpers",
        "//src/mongo/db:service_context_d_test_fixture",
        "//src/mongo/db/auth:authmocks",
        "//src/mongo/db/catalog:catalog_impl",
        "//src/mongo/db/catalog:collection_query_info",
        "//src/mongo/db/collection_crud",
        "//src/mongo/db/exec/document_value:document_value_test_util",
        "//src/mongo/db/exec/sbe:abt_unit_test_utils",
        "//src/mongo/db/exec/sbe:sbe_plan_stage_test",
        "//src/mongo/db/pipeline",
        "//src/mongo/db/pipeline:aggregation_context_fixture",
        "//src/mongo/db/pipeline:aggregation_request_helper",
        "//src/mongo/db/pipeline:document_source_mock",
        "//src/mongo/db/query/collation:collator_factory_mock",
        "//src/mongo/db/query/collation:collator_interface_mock",
        "//src/mongo/db/query/plan_cache:plan_cache_test_util",
        "//src/mongo/db/query/query_settings:manager",
        "//src/mongo/db/query/query_shape",
        "//src/mongo/db/query/util:jparse_util",
        "//src/mongo/db/repl:replmocks",
        "//src/mongo/db/repl:storage_interface_impl",
        "//src/mongo/db/storage:storage_options",
        "//src/mongo/db/storage/devnull:storage_devnull_core",
        "//src/mongo/dbtests:mocklib",
        "//src/mongo/idl:idl_parser",
        "//src/mongo/idl:server_parameter_test_util",
        "//src/mongo/rpc",
        "//src/mongo/util:clock_source_mock",
    ],
)

mongo_cc_unit_test(
    name = "express_execution_test",
    srcs = ["express_plan_test.cpp"],
    tags = ["mongo_unittest_first_group"],
    deps = [
        ":query_planner",
        "//src/mongo/db:query_exec",
        "//src/mongo/db:record_id_helpers",
        "//src/mongo/db:shard_role",
        "//src/mongo/db:write_stage_common",
        "//src/mongo/db/catalog:catalog_test_fixture",
        "//src/mongo/db/collection_crud",
    ],
)

# TODO(SERVER-96860): Remove cycle created by moving //src/mongo/db/query:explain_options.h to //src/mongo/db/query:common_query_enums_and_helpers
filegroup(
    name = "explain_options_hdrs",
    srcs = [":explain_options.h"],
)
